﻿using System;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Competition.Domain.ValueObjects;

namespace Competition.Domain.Entity
{
    /// <summary>
    /// 资讯表
    /// </summary>
    [Serializable, Table("m_product")]
    public class Product : IAggregateRoot
    {
        /// <summary>
        /// id
        /// </summary>
        [Key, Column("id")]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        [Required(ErrorMessage = "必填", AllowEmptyStrings = true)]
        [Display(Name = "id")]
        public int Id { get; set; }
        /// <summary>
        /// 标题
        /// </summary>
        [Column("title")]
        [StringLength(255, MinimumLength = 0, ErrorMessage = "{2}到{1}个字符")]
        [Display(Name = "标题")]
        public string Title { get; set; }
        /// <summary>
        /// 描述
        /// </summary>
        [Column("description")]
        [StringLength(1000, MinimumLength = 0, ErrorMessage = "{2}到{1}个字符")]
        [Display(Name = "描述")]
        public string Description { get; set; }
        /// <summary>
        /// 带样式正文
        /// </summary>
        [Column("html")]
        [Display(Name = "正文")]
        public string Html { get; set; }
        /// <summary>
        /// 无样式正文
        /// </summary>
        [Column("text")]
        [Display(Name = "正文")]
        public string Text { get; set; }
        /// <summary>
        /// 封面
        /// </summary>
        [Column("cover")]
        [StringLength(50, MinimumLength = 0, ErrorMessage = "{2}到{1}个字符")]
        [Display(Name = "封面")]
        public string Cover { get; set; }
        /// <summary>
        /// 添加时间
        /// </summary>
        [Column("addtime")]
        [Display(Name = "添加时间")]
        public DateTime AddTime { get; set; }
        /// <summary>
        /// 状态:0-无效，1-有效
        /// </summary>
        [Column("status")]
        [Display(Name = "Status")]
        public int Status { get; set; }
        [Column("full_name")]
        public string FullName { get; set; }
        [Column("idcard")]
        public string Identity { get; set; }
        [Column("phone")]
        public string Phone { get; set; }
        [Column("annex")]
        public string Annex { get; set; }
        [Column("class_id")]
        public ProductClassEnum? ClassId { get; set; }
    }
}